import com.adobe.cairngorm.control.CairngormEventDispatcher;

import net.optix.ip.events.DeletePractitionerEvent;
import net.optix.ip.events.UpdatePractitionerEvent;
import net.optix.ip.model.ModelLocator;
import net.optix.ip.vo.PractitionerVO;
[Bindable]
private var model:ModelLocator	=	ModelLocator.getInstance();

[Bindable]
private var practitioner:PractitionerVO;

private function selectPractitioner():void
{
	practitioner	=	PractitionerVO(practitioners.selectedItem);
}

public function deletePractitioner():void
{
	var event:DeletePractitionerEvent	=	new DeletePractitionerEvent(practitioner.practitionerID);
	CairngormEventDispatcher.getInstance().dispatchEvent(event);
}
			
public function updatePractitioner():void
{
	model.result	=	"";
	model.bSubmit	=	false;
	model.currentPractitioner	=	practitioner;
	var vo:PractitionerVO 		= 	practitioner;
				
	vo.bAttorney	=	bAttorney.selected?1:0;
	vo.bAgent		=	bAgent.selected?1:0;
	vo.bPatentBar	=	bPatentBar.selected?1:0;
	vo.bEditor		=	bEditor.selected?1:0;
	vo.bDraftsMan	=	bDraftsMan.selected?1:0;
				
	var event:UpdatePractitionerEvent	=	new UpdatePractitionerEvent(vo);
	CairngormEventDispatcher.getInstance().dispatchEvent(event);
}